import request from "@/utils/request"
import {BaseResponse} from "@/api/types/baseResponse";
import {ShopRequest, ShopResponse} from "@/api/types/shop";

// 查询所有门店
export async function getShops() {
    return await request<BaseResponse<ShopResponse[]>, BaseResponse<ShopResponse[]>>({
        url: "/account/shop"
    })
}

// 增加门店
export async function addShop(shopRequest: ShopRequest) {
    return await request<BaseResponse<{}>, BaseResponse<{}>>({url: "/account/shop", method: "POST", data: shopRequest})
}

// 修改门店
export async function updateShop(shopRequest: ShopRequest) {
    return await request<BaseResponse<undefined>, BaseResponse<undefined>>({
        url: "/account/shop",
        method: "PUT",
        data: shopRequest
    })
}

// 根据ID删除门店
export async function deleteShopBySelfId(selfId: number) {
    return await request<BaseResponse<{}>, BaseResponse<{}>>({
        url: "/account/shop",
        method: "DELETE",
        data: {selfid: selfId}
    })
}
